﻿@model JuCheap.Core.Models.UserAddDto

@{
    ViewBag.Title = "添加用户";
    Layout = "~/Views/Shared/_Layout_Content.cshtml";
}

<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>添加用户</h5>
            <div class="ibox-tools">
                <a class="collapse-link">
                    <i class="fa fa-chevron-up"></i>
                </a>
            </div>
        </div>
        <div class="ibox-content">
            <form asp-controller="User" asp-action="Add" class="form-horizontal" method="POST">
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="LoginName"></label>
                    <div class="col-sm-8">
                        <input asp-for="LoginName" class="form-control" placeholder="登录账号名"/>
                        <span asp-validation-for="LoginName"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="RealName"></label>
                    <div class="col-sm-8">
                        <input asp-for="RealName" class="form-control" placeholder="真实姓名" />
                        <span asp-validation-for="RealName"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Email"></label>
                    <div class="col-sm-8">
                        <input asp-for="Email" class="form-control" placeholder="邮箱" />
                        <span asp-validation-for="Email"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="Password"></label>
                    <div class="col-sm-8">
                        <input asp-for="Password" class="form-control" placeholder="登录密码" type="password" />
                        <span asp-validation-for="Password"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="ConfirmPwd"></label>
                    <div class="col-sm-8">
                        <input asp-for="ConfirmPwd" class="form-control" placeholder="请再次输入登录密码" type="password" />
                        <span asp-validation-for="ConfirmPwd"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label" asp-for="DepartmentId"></label>
                    <div class="col-sm-8">
                        <select id="DepartmentId" name="DepartmentId" class="form-control"></select>
                        <span asp-validation-for="DepartmentId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btn btn-info" type="submit">保存</button>
                        <button class="btn btn-white" type="button" id="btnBack">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
@section styles{    
    <link href="~/js/plugins/select2/css/select2.css" rel="stylesheet" />
}

@section scripts{
    <environment names="Development">
        <script src="~/js/jquery.validate.js"></script>
        <script src="~/js/jquery.validate.unobtrusive.js"></script>
        <script src="~/js/base.js"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="~/js/validate.min.js" asp-append-version="true"></script>
        <script src="~/js/base.min.js" asp-append-version="true"></script>
    </environment>    
    <script src="~/js/plugins/select2/js/select2.js"></script>
    <script>
        $("#btnBack").bind("click", function (e) {
            XPage.GoTo(e.target, "@Url.Action("Index")");
        });
        $(function() {
            $('#DepartmentId').select2({
                placeholder: "所属部门",
                ajax: {
                    url: '@Url.Action("GetDepartments", "Department")',
                    dataType: 'json'
                }
            });
        });
    </script>
}
